package com.ruoyi.property.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.property.domain.ReturnPayFeeManageInfo;
import com.ruoyi.property.service.IReturnPayFeeManageInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 退费审核Controller
 * 
 * @author sux
 * @date 2021-06-30
 */
@Controller
@RequestMapping("/property/returnPayFeeManageInfo")
public class ReturnPayFeeManageInfoController extends BaseController
{
    private String prefix = "property/returnPayFeeManageInfo";

    @Autowired
    private IReturnPayFeeManageInfoService returnPayFeeManageInfoService;

    @RequiresPermissions("property:returnPayFeeManageInfo:view")
    @GetMapping()
    public String returnPayFeeManageInfo()
    {
        return prefix + "/returnPayFeeManageInfo";
    }

    /**
     * 查询退费审核列表
     */
    @RequiresPermissions("property:returnPayFeeManageInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ReturnPayFeeManageInfo returnPayFeeManageInfo)
    {
        startPage();
        List<ReturnPayFeeManageInfo> list = returnPayFeeManageInfoService.selectReturnPayFeeManageInfoList(returnPayFeeManageInfo);
        return getDataTable(list);
    }

    /**
     * 导出退费审核列表
     */
    @RequiresPermissions("property:returnPayFeeManageInfo:export")
    @Log(title = "退费审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ReturnPayFeeManageInfo returnPayFeeManageInfo)
    {
        List<ReturnPayFeeManageInfo> list = returnPayFeeManageInfoService.selectReturnPayFeeManageInfoList(returnPayFeeManageInfo);
        ExcelUtil<ReturnPayFeeManageInfo> util = new ExcelUtil<ReturnPayFeeManageInfo>(ReturnPayFeeManageInfo.class);
        return util.exportExcel(list, "returnPayFeeManageInfo");
    }

    /**
     * 新增退费审核
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存退费审核
     */
    @RequiresPermissions("property:returnPayFeeManageInfo:add")
    @Log(title = "退费审核", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ReturnPayFeeManageInfo returnPayFeeManageInfo)
    {
        return toAjax(returnPayFeeManageInfoService.insertReturnPayFeeManageInfo(returnPayFeeManageInfo));
    }

    /**
     * 修改退费审核
     */
    @GetMapping("/edit/{returnFeeId}")
    public String edit(@PathVariable("returnFeeId") Long returnFeeId, ModelMap mmap)
    {
        ReturnPayFeeManageInfo returnPayFeeManageInfo = returnPayFeeManageInfoService.selectReturnPayFeeManageInfoById(returnFeeId);
        mmap.put("returnPayFeeManageInfo", returnPayFeeManageInfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存退费审核
     */
    @RequiresPermissions("property:returnPayFeeManageInfo:edit")
    @Log(title = "退费审核", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ReturnPayFeeManageInfo returnPayFeeManageInfo)
    {
        return toAjax(returnPayFeeManageInfoService.updateReturnPayFeeManageInfo(returnPayFeeManageInfo));
    }

    /**
     * 删除退费审核
     */
    @RequiresPermissions("property:returnPayFeeManageInfo:remove")
    @Log(title = "退费审核", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(returnPayFeeManageInfoService.deleteReturnPayFeeManageInfoByIds(ids));
    }
}
